package com.isunland.managesystem.ui;

import android.view.View;
import android.widget.TextView;
import com.isunland.managesystem.R;

/**
 * 带表头的activity。
 * Created by wangyanan on 2016/10/18.
 */
public abstract class TableHeaderActivity extends SingleFragmentActivity {
  @Override protected int getLayoutResId() {
    return R.layout.activity_table_header;
  }

  public void setHeaderTitle(String[] titles) {

    if (titles == null || titles.length == 0) return;

    View holder = findViewById(R.id.ll_fix_header);
    holder.setVisibility(View.VISIBLE);

    TextView tv1 = (TextView) findViewById(R.id.tv_fixed_header1);
    TextView tv2 = (TextView) findViewById(R.id.tv_fixed_header2);
    TextView tv3 = (TextView) findViewById(R.id.tv_fixed_header3);
    TextView tv4 = (TextView) findViewById(R.id.tv_fixed_header4);
    TextView tv5 = (TextView) findViewById(R.id.tv_fixed_header5);
    TextView tv6 = (TextView) findViewById(R.id.tv_fixed_header6);
    TextView tv7 = (TextView) findViewById(R.id.tv_fixed_header7);
    TextView tv8 = (TextView) findViewById(R.id.tv_fixed_header8);
    TextView tv9 = (TextView) findViewById(R.id.tv_fixed_header9);
    TextView tv10 = (TextView) findViewById(R.id.tv_fixed_header10);
    TextView[] tvs = new TextView[] { tv1, tv2, tv3, tv4, tv5, tv6, tv7, tv8, tv9, tv10 };

    for (int i = 0; i < titles.length; i++) {
      tvs[i].setVisibility(View.VISIBLE);
      tvs[i].setText(titles[i]);
    }
  }
}
